package com.aidex.common.core.domain;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * Entity基类
 *
 * @author Lion Li
 */

@Data
@Accessors(chain = true)
public class BaseEntity implements Serializable {

	private static final long serialVersionUID = 1L;


	public static final String DEL_FLAG_NORMAL = "0";
	public static final String DEL_FLAG_DELETE = "1";
	public static final String STATUS_NORMAL = "0";
	public static final String STATUS_DISABLE = "1";
	public static final String STATUS_DELETE = "2";
	public static final String STATUS_FREEZE = "3";
	public static final String STATUS_AUDIT = "4";
	public static final String STATUS_AUDIT_BACK = "5";
	public static final String STATUS_DRAFT = "9";

	//写入日志时记录变更前对象，变更后对象，日志类型（添加，编辑，删除）
	public static final String LOG_OLD_DATA = "LOG_OLD_DATA";
	public static final String LOG_NEW_DATA = "LOG_NEW_DATA";
	public static final String LOG_TYPE = "LOG_TYPE";

	/**
	 * 搜索值
	 */
	@ApiModelProperty(value = "搜索值")
	@TableField(exist = false)
	private String searchValue;

	/**
	 * 创建者
	 */
	@ApiModelProperty(value = "创建者")
	@TableField(fill = FieldFill.INSERT)
	private String createBy;

	/**
	 * 创建时间
	 */
	@ApiModelProperty(value = "创建时间")
	@TableField(fill = FieldFill.INSERT)
	private Date createTime;

	/**
	 * 更新者
	 */
	@ApiModelProperty(value = "更新者")
	@TableField(fill = FieldFill.INSERT_UPDATE)
	private String updateBy;

	/**
	 * 更新时间
	 */
	@ApiModelProperty(value = "更新时间")
	@TableField(fill = FieldFill.INSERT_UPDATE)
	private Date updateTime;

	/**
	 * 请求参数
	 */
	@ApiModelProperty(value = "请求参数")
	@TableField(exist = false)
	private Map<String, Object> params = new HashMap<>();


	/**
	 * 不等于id，用于唯一性校验
	 */
	@JsonIgnore
	@JSONField(serialize = false)
	@TableField(exist = false)
	private String notEqualId;

}
